# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=ukui-biometric-auth
pkgver=1.2.2
pkgrel=5
pkgdesc="Biometric authentication for UKUI"
arch=('loong64' 'x86_64')
license=('GPL')
url="https://github.com/ukui/ukui-biometric-auth"
groups=('ukui')
depends=('opencv' 'polkit-qt5')
makedepends=('cmake' 'ninja' 'qt5-tools')
source=("$pkgname-$pkgver.tar.gz::https://github.com/ukui/ukui-biometric-auth/archive/v$pkgver.tar.gz")
sha512sums=('11513de8b4a89ccba2b418a6998fdf0c9306c2621442e0e576de53e81a510f99971a6b89ec312c4ab4d387306cd56835b2ea2192473b6eb547a14375de1005f9')

prepare() {
  mkdir -p build
  sed -i 's|qt5/QtWidgets/||' $pkgname-$pkgver/polkit-agent/src/PolkitListener.cpp
  sed -i 's|/lib/security|/usr/lib/security|' $pkgname-$pkgver/pam-biometric/CMakeLists.txt
  sed -i 's|gio-unix-2.0|glib-2.0|' $pkgname-$pkgver/bioauth/src/giodbus.cpp
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -GNinja -DCMAKE_INSTALL_PREFIX=/usr
  ninja
}

package() {
  cd build
  DESTDIR="$pkgdir" ninja install
}
